package org.monster.context.core.communicator;

import org.monster.context.core.headerfilter.*;
import org.monster.context.core.parameter.HttpResponse;
import org.monster.context.core.request.HttpRequest;

/**
 * Htp头
 *
 * @author Monster
 */
public class HttpHeader extends Header {

    /**
     * 构造方法
     */
    public HttpHeader() {
        super();
    }

    /**
     * 构造方法
     *
     * @param name  名称
     * @param value 值
     */
    public HttpHeader(String name, String value) {
        super(name, value);
    }

    /**
     * 过滤处理Http请求头信息
     *
     * @param request  请求
     * @param response 响应
     * @param chain    通道
     */
    @Override
    public void doHeaderFilter(HttpRequest request, HttpResponse response,
                               HeaderFilterChain chain) {
        chain.addHeaderFilter(new HeaderRequestURIFilter());
        chain.addHeaderFilter(new HeaderPathFilter());
        chain.addHeaderFilter(new HeaderKVFilter());
        chain.addHeaderFilter(new HeaderProtocolFilter());
        chain.addHeaderFilter(new HeaderURLFilter());
        chain.addHeaderFilter(new HeaderParameterFilter());
        chain.addHeaderFilter(new HeaderResponseProtocolFilter());
        chain.addHeaderFilter(new HeaderMimeFilter());
        chain.doHeaderFilter(request, response, chain);
    }

}
